<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCoursesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasTable('c_courses')) {
            Schema::create('c_courses', function (Blueprint $table) {
                $table->increments('id')->comment('ID');
                $table->integer('doc_studio_id')->default(0)->comment('医护工作室');
                $table->integer('nums')->comment('课程数');
                $table->string('course_title', 50)->comment('课程标题');
                $table->integer('buy_num')->comment('销量');
                $table->tinyInteger('lesson_isbuy')->default(0)->comment('是否收费(0:免费,1:收费)');
                $table->integer('course_category_id')->default(0)->comment('分类');
                $table->decimal('cource_price')->comment('价格');
                $table->float('cource_score')->comment('评分');
                $table->string('course_img', 255)->default("")->nullable()->comment('logo');
                $table->text('course_info')->comment('简介');
                $table->text('course_images')->comment('图集');
                $table->timestamps();
            });
        }
        Schema::create('c_courses', function (Blueprint $table) {
            $table->increments('id')->comment('ID');
            $table->integer('doc_studio_id')->default(0)->comment('医护工作室');
            $table->integer('nums')->comment('课程数');
            $table->string('course_title', 50)->comment('课程标题');
            $table->integer('buy_num')->comment('销量');
            $table->tinyInteger('lesson_isbuy')->default(0)->comment('是否收费(0:免费,1:收费)');
            $table->integer('course_category_id')->default(0)->comment('分类');
            $table->decimal('course_price')->comment('价格');
            $table->float('course_score')->comment('评分');
            $table->string('course_img',255)->default("")->nullable()->comment('logo');
            $table->text('course_info')->comment('简介');
            $table->text('course_images')->comment('图集');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('c_courses');
    }
}
